package com.gf.zd.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.gf.common.BaseController;
import com.gf.zd.model.Xzqh;
import com.gf.zd.service.XzqhService;

@Controller
@RequestMapping("/xzqh")
public class XzqhController extends BaseController {
	
	private static final Logger LOGGER = LoggerFactory.getLogger(XzqhController.class);
	
	@Autowired
	private XzqhService xzqhService;
	
	/**
	 * 查询所有有效行政区划信息
	 */
	@RequestMapping(value="/xzqhList",method=RequestMethod.POST)
	@ResponseBody 
	public Map<String, Object> getXzqhList(){
		LOGGER.info("开始查询行政区划");
		Map<String, Object> map=new HashMap<String, Object>();
		try{
			List<Xzqh> xzqhList=xzqhService.getXzqhList();
			map.put("success", true);
			map.put("xzqhList", xzqhList);
		}catch(Exception e){
			e.printStackTrace();
			LOGGER.error(e.getMessage());
			map.put("success", false);
			map.put("message", "<br>详情："+e.getMessage());
		}
		return map;
	}
}
